import 'package:flutter/material.dart';

class MyApp13 extends StatelessWidget {
  const MyApp13({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('GridtView'),
              backgroundColor: Colors.black26,
              centerTitle: true,
            ),
            body: GridView.builder(
              // 固定个数，改变宽度
              // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
              // 固定宽度，改变个数
              gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                  crossAxisCount: 3,
                  mainAxisSpacing: 10,
                  crossAxisSpacing: 10),
              itemBuilder:(context, index) {
                return Container(color: Colors.green, child: const Text('1'));
              },
              itemCount: 10,
            )
            ));
  }
}
